<% session.setAttribute("title", "Login"); %> 
<%@ include file="Header.jsp"%>
<% if (request.getParameter("submit") != null) {
	
	session.setAttribute("username", request.getParameter("username"));
	
	if (request.getParameter("role").equals("student")) {
		session.setAttribute("role", "student");
		response.sendRedirect ("CreateProposalPage.jsp");
	} else if (request.getParameter("role").equals("teacher")) {
			session.setAttribute("role", "teacher");
			response.sendRedirect ("ProposalApprovalPage.jsp");
	} else if (request.getParameter("role").equals("reviewer")) {
			session.setAttribute("role", "reviewer");
			response.sendRedirect ("ReviewThesisPage.jsp");
	}
	
 } else { %>
		<form action="Login.jsp">
		<table cellpadding="5" cellspacing="5">
			<tr>
				<th colspan="2">Choose your destiny</th>
			</tr>
			<tr>
				<td>Name: </td> 
				<td><input type="text" name="username"></input></td>
			</tr>
			<tr>
				<td>Role: </td>
				<td> 
						  <select name="role">
								<option value="student">Student</option>
								<option value="teacher">Teacher</option>
								<option value="reviewer">Reviewer</option>
						  </select>
				</td>
			</tr>
			<tr>
				<td>&nbsp;</td>
				<td><input type="submit" name="submit" value="Login" /></td>
			</tr>
		</table>
		</form>
<% } %>
<%@ include file="Footer.jsp"%>